import javax.servlet.http.*;  // provides servlet functionality
import javax.servlet.*;	      // ditto

public class Template {
	
	public static String getTemplateHTML(String title, String restOfPage, int type,
			HttpSession session)
	{
		String str = "";
		str += "<html>";
		str += "<head>";
		str += "<title>" + title + "</title>";
		str += "</head>";
		str += "<body bgColor=\"#FFFFFF\">";
		
		str += "<TABLE bgcolor=\"#FFFFFF\" border=0 bordercolorlight=\"#C0C0C0\" bordercolordark=\"#808080\">";
		str += "<TR valign=top>";
		str += "<TD align=center width=950>";
		
		//str += "<div id=\"image1\" style=\"position:absolute; overflow:hidden; left:22px; top:4px; width:949px; height:220px; z-index:0\"><a href=\"../Main_Page.jsp\"><img src=\"../images/Fabflixs_logo_nova_big.png\" alt=\"\" title=\"\" border=0 width=949 height=220></a></div>";
		//str += "<div id=\"body\" style=\"position:absolute; overflow:hidden; left:22px; top:230px; \">";
		str += "<div id=\"image1\"><a href=\"../Main_Page.jsp\"><img src=\"../images/Fabflixs_logo_nova_big.png\" alt=\"\" title=\"\" border=0 width=949 height=220></a></div>";
		str += "</TD>";
		str += "</TR>";
		
		str += "<TR valign=top>";
		str += "<TD align=center width=950>";
		if (type == Constants.noCheckoutButton)
		{
			//else do nothing
		}
		else if (type == Constants.straightToCart)
		{
			str += "<div>";
			str += "<form name=\"checkout\" method=\"POST\" action=\"DvdProcessor\">";
			str += "<div id=\"checkOutImage\"><input type=\"image\" name=\"CheckoutButton\" src=\"../images/Checkout.png\"></div>";
			str += "</form>";
			str += "</div>";
			
			//session.removeAttribute(Constants.goToCheckoutAttributeName);
		}
		else if (type == Constants.udpateCartAndGoToCart)
		{
			str += "<div>";
			str += "<form name=\"cartForm\" method=\"POST\" action=\"DvdProcessor\">";
			str += "<div id=\"checkOutImage\"><input type=\"image\" name=\"CheckoutButton\" src=\"../images/Checkout.png\"></div>";
			str += "</div>";
			
			//session.setAttribute(Constants.goToCheckoutAttributeName, new Boolean(true));
		}
		
		str += "<div id=\"body\">";
		str += restOfPage;
		
		str += "</div>";
		
		str += "</TD>";
		str += "</TR>";
		str += "</TABLE>";
		
		str += "</body>";
		str += "</html>";
		
		return str;
	}
	
}
